package org.yanh.common.client;

import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;
import org.yanh.common.client.fallback.ItemClientFallback;
import org.yanh.common.domain.dto.ItemDTO;
import org.yanh.common.domain.dto.OrderDetailDTO;

import java.util.Collection;
import java.util.List;

@FeignClient(value ="item",
fallbackFactory = ItemClientFallback.class
)
public interface ItemClient {
    @GetMapping("/items")
    List<ItemDTO> queryItemByIds(@RequestParam("ids") Collection<Long> ids);


    @PutMapping("/stock/deduct")
    void deductStock(@RequestBody List<OrderDetailDTO> items);


    @GetMapping("/items/queryItemTest")
    String queryItemTest();
}
